import os


def init_dir():
    path = os.path.join(
        os.path.expanduser('~'), os.name == 'nt' and 'pynhk' or '.pynhk')
    if (os.name == 'nt'):
        path = 'E:\\sync\\NHK'
    if not os.path.exists(path):
        os.mkdir(path)

    return path


def init_tumblr_dir():
    path = os.path.join(
        os.path.expanduser('~'), os.name == 'nt' and 'pynhk' or '.pynhk')
    if (os.name == 'nt'):
        path = 'D:\\cbenkend\\tumblr'
    if not os.path.exists(path):
        os.mkdir(path)

    return path


APP_DIR = init_dir()
T_APP_DIR = init_tumblr_dir()

RSS_URL = 'http://www.nhk.or.jp/r-news/podcast/nhkradionews.xml'

# DATABASE CONFIG
DB_NAME = os.path.join(APP_DIR, 'pynhk.db')

# CREATE IF not EXISTS news_info
DB_TNEWS = 'news_info'
DB_TCONFIGER = 'news_config'

DB_TRESOURCE = 'tumblr_resource'
DB_TSITES = 'tumblr_site'

DOWNLOAD_DIR = os.path.join(APP_DIR, 'news')

TUMBLR_SITES_FILE = os.path.join(T_APP_DIR, 'sites.txt')
TUMBLR_DOWNLOAD_DIR = os.path.join(T_APP_DIR, 'resource')
TUMBLR_PHOTO_DIR = os.path.join(TUMBLR_DOWNLOAD_DIR, 'photo')
TUMBLR_VIDEO_DIR = os.path.join(TUMBLR_DOWNLOAD_DIR, 'video')
